Repository navigation
docs(local): add read-only, audit and row-level rules to SQL profile - #1168
Open
shengzhaowei wants to merge 1 commit into
Open
shengzhaowei wants to merge 1 commit into
shengzhaowei wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
local/skills/devflow/rules/profiles/sql.mdhad only 5 generic rules (parameterization, indexes, transactions, migrations, review coverage). It said nothing about the cases that actually hurt in practice: a read query that turns into a write, an unbounded read, a write with no audit trail, or a query that assumes the caller can only see their own rows.This PR adds 5 rules (6-10) and a regression test asserting the key sentences exist in the profile:
6. Read-only first: queries are read-only by default. A write must first state why it is needed, its impact, and its rollback plan; do not run INSERT, UPDATE, DELETE, or DDL before write intent is confirmed.
7. Row and timeout limits: queries must have per-project row limits and timeouts. No unbounded reads; narrow the conditions first when a limit is hit, instead of pulling everything back and filtering afterwards.
8. Audit: every write and every sensitive query must leave an audit record (who, when, which statement, how many rows affected). Audit records are append-only, never rewritten. The audit scope for read-only queries depends on sensitivity.
9. Row-level permissions: data spanning multiple tenants, organizations, or scopes must first confirm the row-level isolation condition. Do not assume the caller can only see their own data; if the isolation condition is missing, fail closed and stop at the current stage.
10. Sensitive data: passwords, keys, ID numbers, phone numbers, and similar fields must not be written in plaintext to logs, artifacts, or audit records. Keep only a redacted form when needed; exporting sensitive data requires confirmed authorization first.
No project-specific table names, thresholds, or business details are included. Limits are per-project, following the existing rule against fixed thresholds without project evidence.
Scope
Compatibility
No behavior change. No migration, no version bump, no Classic bundle change. Only the SQL profile text and its regression test change; other profiles and adapters are unaffected.
Validation
Run locally on 2026-11-21, base d58a85a: validate_config OK (adapters=7 logical_roles=10 host_agents=6 artifacts=11); unittest 31 tests OK (incl. test_sql_profile_documents_readonly_audit_and_row_level_rules); validate.sh [1/6]-[6/6] passed; build-classic-hosts.py --check OK; scan-secrets no leaks found; e2e 34 tests OK (skipped=1, playwright not installed); smoke-install passed; test-observability 131 tests OK, source tree clean. Not run: go test, go vet, check-public.py — no Go or public-surface changes in this PR.
Safety
All four safety boxes checked: no credentials/internal endpoints/production data/organization-specific infrastructure; preserved user files and unrelated changes; updated generated Classic host bundles when applicable; documented third-party content and licensing changes when applicable.